package main

import (
	"fmt"
)

func main() {
	var n, v, s int

	for {
		fmt.Scan(&n)
		if n == 0 {
			return
		}

		s = 0
		for i := 0; i < n; i++ {
			fmt.Scan(&v)
			s += v
		}
		fmt.Println(s)
	}
}